import tkinter
import tkinter.constants as TKC
import tkinter.ttk as ttk

class View:
    def __init__(self):
        global root
        root = tkinter.Tk()

class tk:
    def Entry(parent, varRegister):
        variable = tkinter.StringVar()
        varRegister.append(variable)
        self = tkinter.Entry(parent, textvariable=variable)
        self.pack()
        button = tkinter.Button(parent, text="button", command=lambda: print(variable.get()))
        button.pack()
        

class Scheduler:
    def __init__(self):
        self.window_frame = tkinter.Frame(root)
        self.window_frame.pack()
        self.answers=[]
        self.questions=(
            "What is name of the class?",
            "What is the name of the teacher?",
            "What is the start date of the class?",
            "What is the end date of the class?",
            "What is the end date of the class?",
            "How many classes are there?")
        self.moreDetailedQuestion =(
            "What is the room location?",
            "What is the time?",
            "What are the days of the week?"
            )



    def firstFrame(self):
        total_width=2
        from tkinter import StringVar
        class_name = StringVar()
        self.values = {"class_name":class_name,"teacher_name":StringVar(),"begin_date":StringVar(),"end_date":StringVar()}
        self.content_frame = tkinter.Frame(self.window_frame).grid()
        self.headingEntry = ttk.Entry(self.content_frame).pack()
        self.explanation_label = tkinter.Label(self.content_frame, text="Class Details").pack()
        spacer = tkinter.Label(self.content_frame, text="").pack()
        self.label1 = tkinter.Label(self.content_frame, text="Class Name").pack()
        self.entry1 = ttk.Entry(self.content_frame).pack()
        self.label2 = tkinter.Label(self.content_frame, text= "Teacher Name").pack()
        self.entry2 = ttk.Entry(self.content_frame).pack()
        spacer = spacer
        self.label3 = tkinter.Label(self.content_frame, text="Begin Date*").pack()
        self.entry3 = ttk.Entry(self.content_frame).pack()
        spacer
        self.label3 = tkinter.Label(self.content_frame, text="End Date*").pack()
        self.entry3 = ttk.Entry(self.content_frame).pack()
        spacer
        self.label4 = tkinter.Label(self.content_frame, text="Number of Classes*").pack()
        self.entry4 = ttk.Entry(self.content_frame).pack()
        self.explanatory_note = tkinter.Label(self.content_frame, text="* = Optional").pack()
        action = lambda: self.printer()
        tkinter.Button(self.content_frame, command=action, text="Proceed").pack()

    def printer(self):
        print (self.entry2.get())
        

##    def firstFrame(self):
##        total_width=2
##        from tkinter import StringVar
##        #class_name = StringVar()
##        #self.values = {"class_name":class_name,"teacher_name":StringVar(),"begin_date":StringVar(),"end_date":StringVar()}
##        self.content_frame = tkinter.Frame(self.window_frame).grid()
##        self.explanation_label = tkinter.Label(self.content_frame, text="Class Details").grid(row=1, column=1)
##        self.label1 = tkinter.Label(self.content_frame, text="Class Name").grid(row=1, column=0)
##        self.entry1 = tkinter.Entry(self.content_frame).grid(row=1, column=1)
##        self.label2 = tkinter.Label(self.content_frame, text= "Teacher Name").grid(row=2, column=0)
##        self.entry2 = tkinter.Entry(self.content_frame).grid(row=2, column=1)
##        #frame = tkinter.Frame(self.content_frame, relief=tkinter.RAISED).grid(row=3,columnspan=2)
##        self.label3 = tkinter.Label(self.content_frame, text="Begin Date*").grid(column=0)
##        self.entry3 = tkinter.Entry(self.content_frame).grid(row=3,column=1)
##        self.label3 = tkinter.Label(self.content_frame, text="End Date*").grid(row=4, column=0)
##        self.entry3 = tkinter.Entry(self.content_frame).grid(row=4, column=1)
##        self.label4 = tkinter.Label(self.content_frame, text="Number of Classes*").grid()
##        self.entry4 = tkinter.Entry(self.content_frame).grid(row=5, column=1)
##        self.explanatory_note = tkinter.Label(self.content_frame, text="* Optional").grid()
        #tkinter.Button(self.content_frame, command=lambda: print(self.values["class_name"]), text="Proceed").grid()
            
##    def promptQuestion(self, questions, i=0):
##        j = len(questions)
##        try:
##            a=self.answer.get()
##            answers.append(a)
##        except:
##            pass
##        if i < j:
##            question="What is the class name"
##            question_label = ttk.Label(self.window_frame, text = question)
##            question_label.pack()
##            self.answer = ttk.entry(self.window_frame)
##            self.answer.pack()
##            confirm = ttk.button(self.window_frame, command=self.promptQuestion)
##            confirm.pack()
##            cancel = ttk.button(self.window_frame, command=self.destroy())
##            cancel.pack()
##    def processQuestion(self, answers, i):
##        pass

    def secondFrame(self):
        total_width=1
        self.content_frame = tkinter.Frame(self.window_frame)
        self.content_frame.pack()
        self.explanation_label = tkinter.Label(self.content_frame)
        self.explanation_label.grid(row=0,column=0, columnspan=total_width)
        self.weekday_frame = tkinter.Frame(self.content_frame)
        self.weekday_frame.grid(row=1, column=0)
        Weekdays = ('Mon','Tues','Wedn','Thurs','Fri','Sat','Sun')
        self.begin_time = ['','','','','','','']
        self.weekday_values = [tkinter.StringVar(),tkinter.StringVar(),tkinter.StringVar(),tkinter.StringVar(),tkinter.StringVar(),tkinter.StringVar(),tkinter.StringVar()]
        for i in range(7):
            a = tkinter.Label(self.weekday_frame, text = Weekdays[i])
            a.grid(row=0, column = i)           
            self.begin_time[i] = ttk.OptionMenu(self.weekday_frame, self.weekday_values[i], "00:00","8:00", "8:30","9:00","9:30","10:00","10:30","11:00","11:30","12:00","12:30","1:00","1:30","2:00","2:30","3:00","3:30","4:00","4:30")
            self.begin_time[i].grid(row=1, column = i)
        
        self.time_sheet_frame = tkinter.Frame(self.content_frame)
        self.time_sheet_frame.grid()
        a = tkinter.Listbox(self.time_sheet_frame, selectmode=tkinter.EXTENDED)
        a.insert(TKC.END, "Bem","Bob","Bill","Bar")
        a.grid()
        self.b = tkinter.Menubutton(self.time_sheet_frame, text="b", relief="raised")
        self.c = tkinter.Menu(self.b, tearoff=0)
        self.c.add_cascade(label="file")
        self.c.add_command(label="exit")
        self.b.grid()
        var=tkinter.StringVar()
        ttk.OptionMenu(self.time_sheet_frame, var, "a","b","c").grid()
        #self.time_sheet_frame.config(menu=self.b)
##        for i in range(7):
##            self.b = tkinter.Menubutton(self.time_sheet_frame, text=str(i))
##            self.b.children = tkinter.Menu(self.b, tearoff=0)
##            self.b.grid(row=1, column=i)
##            self.b.children.add_checkbutton(label="mayo")
        salad = tkinter.StringVar()
        ttk.Checkbutton(self.weekday_frame, variable=salad, onvalue=1, offvalue=0).grid()
        button = tkinter.Button(self.content_frame, text="press",command=lambda: print(salad.get()))
        button.grid()
        location_frame = tkinter.Frame(self.content_frame)
        location_frame.grid()
            
            

View()
Scheduler().firstFrame()

root.mainloop()
